package com.yixuan.mt.common.mapper;

import com.yixuan.mt.common.entity.User;
import com.yixuan.mt.common.request.PostIdentityRequest;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface IdentityMapper {

    @Insert("insert into user (username, password, policy_list) values(#{username}, #{password}, #{policyList})")
    void insertIdentity(PostIdentityRequest postIdentityRequest);

    @Delete("delete from user where id = #{id}")
    void deleteIdentity(Integer id);

    @Update("update user set password = #{password} where id = #{id}")
    void updatePassword(User user);

    @Select("select id, username from user")
    List<User> selectIdentityList();

    @Select("select policy_list from user where id = #{id}")
    String selectUserPolicyList(Integer id);
}
